package top.cptr.so.aliyundomainserver.controller;

import com.aliyun.alidns20150109.models.DescribeDomainsRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import top.cptr.so.aliyundomainserver.aliyunSDKUtils.exception.CreateClientException;
import top.cptr.so.aliyundomainserver.aliyunSDKUtils.exception.RequestInterfaceException;
import top.cptr.so.aliyundomainserver.pojo.R;
import top.cptr.so.aliyundomainserver.service.DomainMange;

/**
 * 域名管理
 */
@RestController
@RequestMapping("/domainManage")
public class DomainManageController {

    @Autowired
    private DomainMange domainMange;

    /**
     * 获取域名列表
     * @param r
     * @return
     */
    @GetMapping(value = "/describeDomains")
    public R describeDomains(DescribeDomainsRequest param,String token,R r) throws CreateClientException, RequestInterfaceException {
        r.setData(domainMange.describeDomains(token,param));
        r.setStatus(true);
        return r;
    }
    @PostMapping(value = "/describeDomains",produces = "application/json")
    public R describeDomains(@RequestBody DescribeDomainsRequest param,R r,String token) throws CreateClientException, RequestInterfaceException {
        return describeDomains(param,token,r);
    }
}
